package com.xyy.ec.qualification.pojo;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.Serializable;

@Component("sellerDataConfig")
@ConfigurationProperties(prefix = "x.pop")
public class SellerDataConfig implements Serializable {

    @Value("${x.pop.host}")
    private String hostValue;
    @Value("${x.pop.port}")
    private String portValue;
    @Value("${x.pop.userName}")
    private String userNameValue;
    @Value("${x.pop.userPass}")
    private String userPassValue;
    @Value("${x.pop.dbName}")
    private String dbNameValue;
    @Value("${x.pop.dbType}")
    private String dbTypeValue;
    @Value("${x.pop.strategy}")
    private String strategyValue;
    @Value("${x.pop.orgId}")
    private String orgIdValue;
    @Value("${x.pop.appId}")
    private String appIdValue;
    @Value("${x.pop.appSecret}")
    private String appSecretValue;

    //数据库地址
    public static String host;
    //端口
    public static String port;
    //用户名
    public static String userName;
    //密码
    public static String userPass;
    //数据库名称
    public static String dbName;
    //数据库类型
    public static String dbType;
    //策略模式 local:本地模式 localHttp:本地内网模式（http）
    public static String strategy;

    /**
     * 商业账号信息
     */
    public static String orgId;
    public static String appId;
    public static String appSecret;

    /**
     * 过滤session
     */
    public static final String appKey = "xyy-pop-merchant-uploadFDFSWithoutCookie-5d3e9a7b2c1f4b5e8d6f0a9b8c7d6e5f";

    @PostConstruct
    public void init() {
        host = this.hostValue;
        port = this.portValue;
        userName = this.userNameValue;
        userPass = this.userPassValue;
        dbName = this.dbNameValue;
        dbType = this.dbTypeValue;
        strategy = this.strategyValue;
        orgId = this.orgIdValue;
        appId = this.appIdValue;
        appSecret = this.appSecretValue;
    }

    private SellerDataConfig() {
    }

}